<?php
namespace catchAdmin\archives\service;

use catcher\exceptions\FailedException;
use app\common\model\Follow as FollowModel;

class DetailedService
{
   /**
    * 检查患者是否有随访任务
    * @param string $patientId
    * @return array
    */
    public function check(string $patientId): array
    {
        $data = (new FollowModel())->getOneData(['patientId' => $patientId], 'id,task_id');

//        if (empty($data['id']))
//        {
//            throw new FailedException("患者未绑定随访计划任务");
//        }

        $ret = [];
        if ($data) {
            $ret['follow_id'] = $data['id'];
            $ret['task_id'] = $data['task_id'];
        }
        return $ret;
    }
}